import request from '@/assets/utils/request'

/* ****************************************   目录   ***************************************************/
// 获取目录列表
export const getDirectoryList = params => {
  return request({
    url: '/directorys',
    method: 'GET',
    params
  })
}

// 添加目录列表的数据
export const addDirectoryList = data => {
  return request({
    url: '/directorys',
    method: 'post',
    data
  })
}

// 修改目录列表的数据
export const resetDirectoryList = obj => {
  return request({
    url: '/directorys/' + obj.id,
    method: 'put',
    data: obj
  })
}

// 修改目录状态
export const resetDirectorysStatet = obj => {
  return request({
    url: '/directorys/' + obj.id + '/' + obj.state,
    method: 'post'
  })
}

// 删除目录
export const deleteDirectory = id => {
  return request({
    url: '/directorys/' + id,
    method: 'DELETE'
  })
}

/* ****************************************   标签   ***************************************************/
// 获取tag标签数据
export const getTags = params => {
  return request({
    url: '/tags',
    method: 'get',
    params
  })
}

// 添加tag标签的数据
export const addTags = data => {
  return request({
    url: '/tags',
    method: 'post',
    data
  })
}

// 修改标签列表的数据
export const resetTags = obj => {
  return request({
    url: '/tags/' + obj.id,
    method: 'put',
    data: obj
  })
}

// 修改标签状态
export const resetTagsStatet = obj => {
  return request({
    url: '/tags/' + obj.id + '/' + obj.state,
    method: 'post'
  })
}

// 删除标签列表
export const deleteTag = id => {
  return request({
    url: '/tags/' + id,
    method: 'DELETE'
  })
}

// 获取学科名称
export const gstSubList = () => {
  return request({
    url: '/subjects/simple',
    method: 'get'
  })
}
